package com.example.demo.dao;

import com.example.demo.entity.Register;
import com.example.demo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserDao extends JpaRepository<User,Integer> {

    //全查询
    List<User> findAll();

    //登录
    User findByAccounts_NameAndAccounts_Pwd(String username,String password);

    //注册
    User findByAccounts_Name(String username);

    //注册和修改
    User saveAndFlush(User user);

    //删除
    void deleteById(int id);

    //查看
    User findById(int id);

}
